if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[v_tb_posstoredvaluecard]') and OBJECTPROPERTY(id, N'IsView') = 1)
drop view [dbo].[v_tb_posstoredvaluecard]
GO
/****** Object:  View [dbo].[v_tb_posstoredvaluecard]    Script Date: 10/17/2017 17:30:26 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO




create  view [dbo].[v_tb_posstoredvaluecard]
as

SELECT     cast(0 as bit) choice,m.bid m_bid, m.bkind m_bkind, m.bstate m_bstate, m.bcode m_bcode,    m.bdate m_bdate, m.create_by m_create_by, m.deptid m_deptid, m.empid m_empid, 
m.filid m_filid, m.balanceid m_balanceid, m.accountid m_accountid, m.checkno m_checkno, m.amount m_amount, m.voucherid m_voucherid, m.relationcount m_relationcount, 
m.create_time m_create_time, m.remark m_remark, m.sflag m_sflag, m.update_time AS m_update_time,m.custom1 m_custom1,m.custom2 m_custom2,m.custom3 m_custom3,m.custom4 m_custom4,m.custom5 m_custom5,    m.custom6 m_custom6,m.custom7 m_custom7,m.custom8 m_custom8,m.custom9 m_custom9,m.custom10			m_custom10,m.custom11 m_custom11,m.custom12 m_custom12,m.custom13 m_custom13,m.custom14 m_custom14	, m.custom15 m_custom15, d.*
FROM tb_posstoredvaluecard m left JOIN
     tb_posstoredvaluecarddtl d ON m.bid = d.bid
GO


